package com.controller;

import com.domain.Question;
import com.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.*;

@Controller
@RequestMapping("question")
public class QuestionController {

    @Autowired
    QuestionService questionService;

    @RequestMapping("/findAllQuestion")
    public String findAllQuestion(){
        System.out.println(questionService.findAllQuestion());
        return "success";
    }

    @RequestMapping("/commitQuestion")
    public String commitQuestion(Question question){
        Boolean r= questionService.commitQuestion(question);
        if (r==true){
            return "success";
        }else {
            return "error";
        }
    }
}
